<!--
 * @Author: your name
 * @Date: 2021-08-25 09:48:05
 * @LastEditTime: 2021-11-05 14:42:40
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jinfeng_up\src\views\systemSetting\dataRefresh.vue
-->
<template>
  <div>
    <el-button type="primary" @click="onExport" class="dataRefresh">数据刷新</el-button>
  </div>
</template>

<script>
import { ApiRequest } from '@/api/setting/service.js'
export default {
    methods: {
    /**
     * @description:点击数据刷新按钮
     */
        async onExport() {
            const loading = this.$loading({
                lock: true,
                text: '数据刷新中',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0.7)'
            })
            try {
                const result = await ApiRequest.ApiRequestInsertAsync()
                if (result.success) {
                    loading.close()
                    this.$message.success('数据刷新成功')
                } else {
                    loading.close()
                    this.$message.error('数据刷新失败')
                }
            } catch (err) {
                loading.close()
                this.$message.error('服务器异常')
            }
        }
    }
}
</script>

<style scoped lang="less">
.dataRefresh {
  width: 90px;
  height: 30px;
  background: #eaf2ff;
  border: 1px solid #3579e0;
  border-radius: 5px;
  color: #3579e0;
  line-height: 8px;
}
</style>
